<%--
  Created by IntelliJ IDEA.
  User: 高朋
  Date: 2020/11/14
  Time: 9:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加失败</title>

    <style>
       div{
            text-align: center;
        }
        span{
            color: red;
        }

    </style>
</head>
<body>
<div>
    <p>书籍已存在，<span id="time">5</span>秒之后，返回到添加页面...</p>
    <a href="${pageContext.request.contextPath}/mainFrame.jsp">返回首页</a>
</div>

<script>
    let second=5;
    function showTime()
    {
        second--;
        if(second<=0)
            location.href="${pageContext.request.contextPath}/add.jsp";
        let time=document.getElementById("time");
        time.innerHTML=second+"";
    }

    //设置定时器，一秒执行一次
    setInterval(showTime,1000);
</script>


</body>
</html>

